package com.mszlu.blog.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: linKe
 * @version: 1.0
 * @Description: mybatis 分页组件
 * MapperScan 设置mapper的扫描范围
 */
@Configuration
@MapperScan("com.mszlu.blog.dao.mapper")
public class MybatisPlusConfig {

    /**
     * 分页插件 配置
     * @return interceptor
     * @Author linKe
     * @Date 2021/12/4 23:45
     * mybatisPlusInterceptor 拦截器
     */

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }
}
